<template>
    <div class="flex flex-col">
        <div class="flex mb-1 mt-1">
            <LInput placeholder="请输入请求地址" v-model:value="state.address" />
            <LButton @click="handleSend" class="w-16 m-1"> 
                发送
            </LButton>
        </div>
        <div class="flex-1">
            <JsonEditor v-model="state.template" />
        </div>
    </div>
</template>
<script setup>
import JsonEditor from "json-editor-vue";
import { reactive } from "vue";
import { requestTemplate } from "@/constant/template/index.js";
import { repaly } from "@/utils/request-util";
import { LInput } from "@/components";

const state = reactive({
  template: requestTemplate,
  address: "",
});

function handleSend() {
  state.template.url = state.address;
  repaly(state.template);
}

</script>